package gameFrame;

import java.awt.*;

public class Shell02 extends GameObject02{
    double degree;

    @Override
    public void drawMySelf(Graphics g) {
        Color c= g.getColor();
        g.setColor(Color.yellow);
        g.fillOval(x,y,width,height);
        if(y<500){
            y +=speed;
        }

       /* //炮弹沿着任意角度飞行
        x += speed*Math.cos(degree);
        y += speed*Math.sin(degree);
        //实现边界弹回去
        if(y>GameUtil02.FRAME_HIGHT ||y<30){
            degree = -degree;
        }
        if(x>GameUtil02.FRAME_WIDTH-10 || x<0){
            degree =Math.PI-degree;
        }*/
        //画完返回原来颜色
        g.setColor(c);
    }


    public Shell02(){
       // degree =Math.random()*Math.PI*2; //任意角度
        degree = (int)(Math.random()*Math.PI);

        x= (int)(500*Math.random());//10是子弹性的宽度
        y= 30;
        width= 10;
        height = 10;
        speed = 5;

    }
}
